/**
 * 通过百度api获取当前浏览器经纬度
 * 
 * @author lipeishan 2017/10/11
 */

$(function() {

	var geolocation = new BMap.Geolocation();
	geolocation.getCurrentPosition(function(r) {
		if (this.getStatus() == BMAP_STATUS_SUCCESS) {
			// $('#LNG').attr("disabled","true");
			// $('#LAT').attr("disabled","false");
			if ($('#LNG').val() != '' && $('#LNG').val() != null) {
				return;
			} else {
				$('#LNG').val(r.point.lng);
				$('#LAT').val(r.point.lat);
				// 创建一个地理位置解析器
				// 以指定的经度与纬度创建一个坐标点
				var pt = new BMap.Point(r.point.lng, r.point.lat);
				var geoc = new BMap.Geocoder();
				geoc.getLocation(pt, function(rs) {// 解析格式：城市，区县，街道
					var addComp = rs.addressComponents;
					$('#position').val(
							addComp.city + addComp.district + addComp.street);
				});
			}

		} else {
			alert('定位失败');
		}
	}, {
		enableHighAccuracy : true
	})// 指示浏览器获取高精度的位置，默认false

});

function main(input) {
	var a = callBackGetAccountInfo('a001937c876855d60b8c0ab47415f5f4d765d10e4e0148');
	if (a)
		callBackLog(a);
	var sender = 'a00112fb02e0274c332fc70ce3e3250a85c66a4f58d955';
	var thisAddress = 'a001dc9bf1f2c9c910630e4c940b54e19e1f021a72e8f2';
	var tx = {
		'operations' : [ {
			'type' : 3,
			'payment' : {
				'dest_address' : sender,
				'asset' : {
					'property' : {
						'issuer' : thisAddress,
						'code' : 'a001de46870612e0146be7d6d92fccc734a2ccd0da8062'
					},
					'amount' : 1
				}
			}
		} ]
	};
	callBackDoOperation(tx);
}
